
import Relay from "react-relay";

export default class CreateOrUpdateDepartmentMutation extends Relay.Mutation {

    static fragments = {};

    getMutation() {
        return Relay.QL`mutation { createOrUpdateDepartment }`;
    }

    getVariables() {
        return {
            argsInput: {
                enterprizeId:this.props.enterprizeId,
                name: this.props.name,
                description:this.props.description,
                depId:this.props.rid
            }
        };
    }

    getFatQuery() {
        return Relay.QL`fragment on createOrUpdateDepartmentPayload {
            createOrUpdateDepartment {
                errorCode
                value
                totalResult
                id
                token
                department{
                    name
                    description
                    pkId{
                        rid
                        enid
                    }
                }
                
            }
        }`;
    }

    getConfigs() {
        return [{
            type: 'REQUIRED_CHILDREN',
            children: [Relay.QL`
              fragment on createOrUpdateDepartmentPayload {
                    createOrUpdateDepartment {
                        errorCode
                        value
                        totalResult
                        id
                        token
                        department{
                            name
                            description
                            pkId{
                                rid
                                enid
                            }
                        }
                    }
                }
            `]
        }];
    }

}